package com.fjl;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.List;

@Data
@Document(indexName = "file_index")
public class FileDocument {
    @Id
    private String id;

//    @Field(type = FieldType.Keyword)

    @Field(type = FieldType.Text, analyzer = "standard")
    private String fileName;

    @Field(type = FieldType.Keyword)
    private String filePath;

    @Field(type = FieldType.Text, analyzer = "standard")
    private String content; // 解析出的文本内容

    @Field(type = FieldType.Keyword)  // 关键词类型，适用于标签
    private List<String> tags;

    public FileDocument() {
    }

    public FileDocument(String fileName, String filePath, String content) {
        this.fileName = fileName;
        this.filePath = filePath;
        this.content = content;
    }
}
